//
//  DayCell.m
//  YouthOlympic2014
//
//  Created by xiangpaopao on 14-6-20.
//  Copyright (c) 2014年 mitian. All rights reserved.
//

#import "DayCell.h"

@implementation DayCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self)
    {
        // change to our custom selected background view
        //UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(8, 0, 28, 11)];
        //self.backgroundView = bgView;
        [self.bgView setBackgroundColor:[UIColor clearColor]];
        
    }
    return self;
}


-(void)setDisabled:(BOOL)disabled
{
    if (disabled) {
        [self.textLabel setAlpha:.3];
    }else{
        [self.textLabel setAlpha:1];
    }
    
    [self setUserInteractionEnabled:!disabled];
}


-(void)setHasMatch:(BOOL)hasMatch
{
    if (hasMatch) {
        [self.statusLabel setHidden:NO];
    }else{
        [self.statusLabel setHidden:YES];
    }
}

-(void)setHighlighted:(BOOL)highlighted
{
    if (highlighted) {
        [self.textLabel setTextColor:HEX2UIColor(0xffffff)];
        [self.bgView setBackgroundColor:HEX2UIColor(0xb7d200)];
        [self.statusLabel setBackgroundColor:HEX2UIColor(0xffffff)];
    }else{
        [self.textLabel setTextColor:HEX2UIColor(0xb7d200)];
        [self.bgView setBackgroundColor:[UIColor clearColor]];
        [self.statusLabel setBackgroundColor:HEX2UIColor(0xb7d200)];
    }
}

-(void)setSelected:(BOOL)selected
{
    if (selected) {
        [self.textLabel setTextColor:HEX2UIColor(0xffffff)];
        [self.bgView setBackgroundColor:HEX2UIColor(0xb7d200)];
        [self.statusLabel setBackgroundColor:HEX2UIColor(0xffffff)];
    }else{
        [self.textLabel setTextColor:HEX2UIColor(0xb7d200)];
        [self.bgView setBackgroundColor:[UIColor clearColor]];
        [self.statusLabel setBackgroundColor:HEX2UIColor(0xb7d200)];
    }
}

@end
